package com.engine.plugin.annual.cmd;

import com.engine.annual.cmd.AnnualGetCmd;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;

import java.util.Map;

@CommandDynamicProxy(target = AnnualGetCmd.class, desc = "功能描述")
public class AnnualGetInfoCmd extends AbstractCommandProxy<Map<String, Object>> {
    @Override
    public Map<String, Object> execute(Command<Map<String, Object>> command) {

        System.out.println(getClass().getName() + "command 执行之前做一些事");

        //获取到被代理的对象
        AnnualGetCmd annualGetCmd = (AnnualGetCmd) command;
        //获取被代理对象的参数
        Map<String, Object> params = annualGetCmd.getParams();
        //对参数做预处理
        //TODO
        //参数写回
        annualGetCmd.setParams(params);
        //执行标准的业务处理
        Map<String, Object> result = nextExecute(command);

        System.out.println(getClass().getName() + "command 执行之后做一些事情");

        //对返回值进行处理
        result.put("a", "b");

        return result;
    }
}
